/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package auctions;

/**
 *
 * @author hangsu
 */
public class ScheduleSequentialAuctionHouse extends ScheduleAuctionhouse {
    public ScheduleSequentialAuctionHouse(int nAuctions, AuctionType tAuctions) {
        super(nAuctions, tAuctions);
        this.house_type = AuctionHouseType.SEQUENTIAL;
    }
    
    @Override
    public void startAuctions() {
        this.clear();
        int auctionIdx;
        
        for(auctionIdx=0; auctionIdx<this.auctionNum; auctionIdx++) {
            /* pass auction-wide information to bidders */
            this.auctions.get(auctionIdx).initializeBidders();
        }
        
        for(auctionIdx = 0; auctionIdx<this.auctionNum; auctionIdx++) {
            this.auctions.get(auctionIdx).runAuction();
            AuctionResult e = this.auctions.get(auctionIdx).getAuctionResult();
            this.aResults.add(e);
            for(ScheduleAgent a : this.agents)
                a.reportResult(e);
        }
        
        for(ScheduleAgent a : this.agents)
            this.bResults.add(a.getBidderResult());	

    }
}
